home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 42
/
Amiga Format AFCD42 (Issue 126, Aug 1999).iso
/
-coverdisks-
/
126a
/
football
/
user
/
cup_cupinformation.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1999-05-22
|
15KB
|
502 lines
/* ***********************************************************************
CUP INFORMATION PROGRAM FOR FOOTBALL REXX SUITE
-------------------------------------------------
Copyright Mark Naughton 1998
Version Date History
--------------------------------------------------------------------------
1.0 140998 First release.
160998 Changed way best record is calculated.
**************************************************************************
Procedure
---------
1. Check files exist.
2. Read '.cf' file and get details. Read '.cfrw' and do the same.
3. If '.cfsave' doesn't exist, read the '.scf' file adjusting the output
for replays, extra time, first leg and penalties.
4. If '.cfsave' is found, read to display current matches.
5. Read '.scf' into an array. Search array, storing goals. When finished,
search through the team array, calculating the best record :
(Goals Scored / Goals Away) * Matches Played
Goals Scored = Goals Scored At Home + (Goals Scored Away * 1.5)
6. Write data to a file and call an external sort program. Read the details
back in and delete the temporary file.
7. Adjust options.
8. Display report : display options/rounds, teams and the best record, the
current round matches and if the history file has been selected, read
the file for previous/current winners.
9. Exit.
************************************************************************** */
PARSE ARG league_stuff
version = 1
input_file = '.cf'
input2_file = '.scf'
input3_file = '.cfrw'
input4_file = '.cfh'
input5_file = '.cfsave'
output_file = 'RAM:Football.tempcup'
title = '*CUP_TITLE='
thirdpl = '*CUP_THIRD='
rounddef = '*CUP_RNDDEF='
currond = '*CUP_ROND='
currrondn = '*CUP_CRDN='
roundddef = '*CUP_RDEF='
cuphistory = '*CUP_HISTORY='
thirdpl = '*CUP_THIRD='
teams_cnt = '*CUP_TCNT='
awaygs = '*CUP_AWAYG='
schedtype = '*CUP_SCHEDULE='
first = '*WINNER='
pkversion = '* Version='
matches. = '???'
separator = '*'
teams. = '???'
rnds. = '???'
lines. = '???'
replays. = '???'
working. = '???'
losing. = '???'
repct = 0
repno. = '???'
tcount = 0
ttc = 0
rndcnt = 0
linesct = 0
league_file = "Data/"league_stuff
curnd = ''
curndn = 0
not_played = "__ __"
mcount = 0
bstats. = '???'
btemp. = '???'
btcnt = 0
bpstats. = '???'
bgsstats. = '???'
bgastats. = '???'
bagstats. = '???'
parse var league_stuff league_file search_team
league_file = "Data/" || league_file
if exists(league_file || input_file) = 0 then exit
if exists(league_file || input2_file) = 0 then exit
tcount = 0
if open(datafile,league_file || input_file,'r') then do
do while ~eof(datafile)
line = readln(datafile)
if pos(title,line) > 0 then cupname = delstr(line,1,11)
if pos(thirdpl,line) > 0 then third = delstr(line,1,11)
if pos(awaygs,line) > 0 then awaygoals= delstr(line,1,11)
if pos(pkversion,line) > 0 then fversion = delstr(line,1,12)
if pos(cuphistory,line) > 0 then cuph = delstr(line,1,13)
if pos(schedtype,line) > 0 then scht = delstr(line,1,14)
if pos(rounddef,line) > 0 then do
rndcnt = rndcnt + 1
rnds.rndcnt = delstr(line,1,12)
end
if pos(separator,line) = 0 then do
line = strip(line)
tcount = tcount + 1
teams.tcount = line
end
end
close(datafile)
end
else do
say
say "ERROR : (CupInformation)"
say
say "Unable to open '"league_file || input_file"' file."
exit
end
if open(datafile,league_file || input3_file,'r') then do
do while ~eof(datafile)
line = readln(datafile)
if pos(currond,line) > 0 then crond = strip(substr(line,11,2))
if pos(roundddef,line) > 0 then tcrondn= strip(substr(line,11,5))
if pos(currrondn,line) > 0 then do
crondn = strip(substr(line,11,30))
tleg_no = 0
if pos("1 Leg",line) > 0 then tleg_no = 1
if pos("2 Legs",line) > 0 then tleg_no = 2
end
end
close(datafile)
end
else do
say
say "ERROR : (CupInformation)"
say
say "Unable to open '"league_file || input3_file"' file."
exit
end
a = 0
mcount = 0
if exists(league_file || input5_file) = 0 then do
if open(datafile,league_file || input2_file,'r') then do
do while ~eof(datafile)
line = readln(datafile)
if pos("*Round="strip(tcrondn),line) > 0 then
a = 1
if a = 1 then do
if pos(separator,line) = 0 & pos('#',line) = 0 then do
mcount = mcount + 1
matches.mcount = line
end
else do
if pos("Replay",line) > 0 then do
mcount = mcount + 1
matches.mcount = " "
mcount = mcount + 1
matches.mcount = "Replay"
mcount = mcount + 1
matches.mcount = "------"
mcount = mcount + 1
matches.mcount = " "
end
if pos("#1st Leg",line) > 0 then do
mcount = mcount + 1
matches.mcount = overlay("After 1st Leg",line,1,13)
end
if pos("#Score After Extra Time",line) > 0 then do
mcount = mcount + 1
matches.mcount = overlay("Score After Extra Time ",line,1,23)
end
if pos("#Penalties",line) > 0 then do
mcount = mcount + 1
matches.mcount = overlay("After Penalties",line,1,15)
end
end
end
end
close(datafile)
end
else do
say
say "ERROR : (CupInformation)"
say
say "Cannot open '"league_file||input2_file"' for reading."
exit
end
end
else do
if open(datafile,league_file || input5_file,'r') then do
do while ~eof(datafile)
line = readln(datafile)
if pos(separator,line) = 0 & pos('#',line) = 0 then do
mcount = mcount + 1
matches.mcount = line
end
else do
if pos(not_played,line) = 0 then do
if pos("Replay",line) > 0 then do
mcount = mcount + 1
matches.mcount = " "
mcount = mcount + 1
matches.mcount = "Replay"
mcount = mcount + 1
matches.mcount = "------"
mcount = mcount + 1
matches.mcount = " "
end
if pos("#1st Leg",line) > 0 then do
mcount = mcount + 1
matches.mcount = line
matches.mcount = overlay("After 1st Leg",matches.mcount,1,13)
end
if pos("#Score After Extra Time",line) > 0 then do
mcount = mcount + 1
matches.mcount = line
matches.mcount = overlay("Score After Extra Time ",matches.mcount,1,23)
end
if pos("#Penalties",line) > 0 then do
mcount = mcount + 1
matches.mcount = line
matches.mcount = overlay("After Penalties",matches.mcount,1,15)
end
end
end
end
close(datafile)
end
else do
say
say "ERROR : (CupInformation)"
say
say "Cannot open '"league_file||input5_file"' for reading."
exit
end
end
do i=1 to tcount
bpstats.i = 0
bgsstats.i = 0
bgastats.i = 0
bagstats.i = 0
end
np = 0
btcnt = 0
if open(datafile,league_file || input2_file,'r') then do
do while ~eof(datafile)
line = readln(datafile)
btcnt = btcnt + 1
btemp.btcnt = line
end
close(datafile)
end
else do
say
say "ERROR : (CupInformation)"
say
say "Cannot open '"league_file||input2_file"' for reading."
exit
end
do k=1 to btcnt
if pos(not_played,btemp.k) = 0 & pos(separator,btemp.k)